using UnityEngine;
using System.Collections;
using System.Collections.Generic;


public class NAID_System {
	
	private static Dictionary<NAID_Data, NAID_System> managers = new Dictionary<NAID_Data, NAID_System>();
	private NAID_Data data;
	
	public static NAID_System LoadDataFile(NAID_Data _data)
	{
		if(managers.ContainsKey(_data))
			return managers[_data];
		
		NAID_System manager = new NAID_System();
		managers.Add(_data, manager);
		
		manager.data = _data;
		
		return manager;
	}
	
	public static NAID_System LoadDataFile(string path)
	{
		 return LoadDataFile(Resources.Load(path) as NAID_Data);
	}
	
	public NAID_Scene GetScene(string sceneName)
	{
		NAID_Scene ret = new NAID_Scene();
		
		foreach(NAID_Data.NAID_Node node in data.nodes)
		{
			if(node.nodeSet == sceneName)
				ret.AddNode(node);
		}
		
		return ret;
	}
	
}
